<?php
require_once ('../lib/config.php');
require_once ('../lib/facebook.php');
require_once ('../lib/friends.php');
require_once ('../lib/activity.php');
require_once ('../lib/test.php');
require_once ('f:\wamp\www\simpletest\autorun.php');
require_once ('../lib/init.php');

class TestTemplate extends UnitTestCase {
    
    function setUp(){
        global $login_button;
        try{
        $me = getOneself();
        }catch(Exception $e){
            print($login_button);
            exit();
        }
    }
    
    //refer to http://www.simpletest.org/en/unit_test_documentation.html
    function testGetInMessageActivities(){ 
    
        $data = array(
            'name' => 'inMessageQuery',
            'fql_result_set' => Array(
                    '0' => Array(
                            'author_id' => '612139051',
                            'body' => 'Brilliant thanks',
                            'created_time' => '1287740287',
                            'thread_id' => '1356257881067'
                        ),

                    '1' => Array(
                            'author_id' => '612139051',
                            'body' => "Hi Laurence, fantastic that's great news, you must be delighted the job search has come to an end. What's comp's name, how many employees/departments? Is it a temp job of permanent? Where abouts in Edinburgh is it based? How did you hear about it? You still thinking of emmigrating to Oz? Youre not the only person who's put the diss on the back burner. 

I'm good. Delighted to have the app up n working on phone. Tested 2 kids yesterday and they were great at telling me what they did and didnt like, very astute. So have another 2 to test this side and then I'll go home and test all my different cousins kids who are that age (ive school reunion to go to). Then Evaluation, write up and smell you later for-EVA dissertation. When things get better again I might try sell it to councils or park/environmental organisations who want to get kids more involved. Other than that attending things on in the college, networking things and the like so fingers crossed for employment.",
                            'created_time' => '1288083362',
                            'thread_id' => '1356257881067'
                        )
                )
        );
        $activities = array();
        $activities = getInMessageActivities($data, $activities);
        
        $this->assertTrue(is_array($activities));
        $this->assertTrue(count($activities) == 2);
//        print_r($activities);
    }
    
    function testRealData(){
        $data = getActivities('612139051');
        $inMessageData = getResultSet('inMessageQuery', $data);
        $activities = array();
        $activities = getInMessageActivities($inMessageData, $activities);
        $this->assertTrue(is_array($activities));
        print_r($activities);
    }
}
?>